/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hvkdbmc;

import hvkdbmc.entities.HVKColumnInfo;
import hvkdbmc.entities.HVKTableInfo;
import hvkdbmc.setting.HVKBaseUtils;
import hvkdbmc.setting.HVKOracleDiscover;
import java.util.ArrayList;

/**
 *
 * @author LuckyMan
 */
public class HVKDBMC {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        HVKTableInfo tableInfo = new HVKTableInfo();

//        tableInfo.name = "TIC_ADMIN";
//        tableInfo.colums.put("ad_ID", new HVKColumnInfo("ad_ID", "integer", true, tableInfo.name + "_SEQ_" + "ad_ID"));
//        tableInfo.colums.put("ad_User", new HVKColumnInfo("ad_User", "varchar", false, ""));
//        tableInfo.colums.put("ad_Pass", new HVKColumnInfo("ad_Pass", "varchar", false, ""));
//        tableInfo.colums.put("ad_flName", new HVKColumnInfo("ad_flName", "varchar", false, ""));
//        tableInfo.colums.put("ad_Address", new HVKColumnInfo("ad_Address", "varchar", false, ""));
//        tableInfo.colums.put("ad_Position", new HVKColumnInfo("ad_Position", "varchar", false, ""));
//        tableInfo.colums.put("ad_Email", new HVKColumnInfo("ad_Email", "varchar", false, ""));
//        tableInfo.colums.put("ad_Phone", new HVKColumnInfo("ad_Phone", "varchar", false, ""));
//        tableInfo.colums.put("ad_Notes", new HVKColumnInfo("ad_Notes", "varchar", false, ""));


//        
//        tableInfo.name = "TIC_CUSTOMER";
//        tableInfo.colums.put("cs_ID", new HVKColumnInfo("cs_ID", "integer", true, tableInfo.name + "_SEQ_" + "cs_ID"));
//        tableInfo.colums.put("cs_Name", new HVKColumnInfo("cs_Name", "varchar", false, ""));
//        tableInfo.colums.put("cs_DateEsta", new HVKColumnInfo("cs_DateEsta", "date", false, ""));
//        tableInfo.colums.put("cs_Address", new HVKColumnInfo("cs_Address", "varchar", false, ""));
//        tableInfo.colums.put("cty_ID", new HVKColumnInfo("cty_ID", "integer", false, ""));
//        tableInfo.colums.put("dis_ID", new HVKColumnInfo("dis_ID", "integer", false, ""));
//        tableInfo.colums.put("vi_ID", new HVKColumnInfo("vi_ID", "integer", false, ""));
//        tableInfo.colums.put("cs_Email", new HVKColumnInfo("cs_Email", "varchar", false, ""));
//        tableInfo.colums.put("cs_Regis", new HVKColumnInfo("cs_Regis", "varchar", false, ""));
//        tableInfo.colums.put("cs_rgDate", new HVKColumnInfo("cs_rgDate", "date", false, ""));
//        tableInfo.colums.put("cs_rgPlace", new HVKColumnInfo("cs_rgPlace", "varchar", false, ""));
//        tableInfo.colums.put("cs_txCode", new HVKColumnInfo("cs_txCode", "varchar", false, ""));
//        tableInfo.colums.put("cs_Tel", new HVKColumnInfo("cs_Tel", "varchar", false, ""));
//        tableInfo.colums.put("cs_Fax", new HVKColumnInfo("cs_Fax", "varchar", false, ""));
//        tableInfo.colums.put("cs_Web", new HVKColumnInfo("cs_Web", "varchar", false, ""));
//        tableInfo.colums.put("cr_ID", new HVKColumnInfo("cr_ID", "integer", false, ""));
//        tableInfo.colums.put("sb_ID", new HVKColumnInfo("sb_ID", "integer", false, ""));
//        tableInfo.colums.put("sc_ID", new HVKColumnInfo("sc_ID", "integer", false, ""));
//        tableInfo.colums.put("bk_ID", new HVKColumnInfo("bk_ID", "integer", false, ""));
//        tableInfo.colums.put("cs_bankNum", new HVKColumnInfo("cs_bankNum", "varchar", false, ""));
//        tableInfo.colums.put("cs_Date", new HVKColumnInfo("cs_Date", "date", false, ""));
//        tableInfo.colums.put("cs_Notes", new HVKColumnInfo("cs_Notes", "varchar", false, ""));

//        String abc = HVKBaseUtils.MakeSQLMapFromTable(tableInfo);
//
//        HVKBaseUtils.MakeModelFileFromTable(tableInfo);
//
//        System.out.println(abc);
//        System.out.println("================================");
//        String xyz = HVKBaseUtils.MakeModelBodyFormTable(tableInfo);
//        System.out.println(xyz);

        ArrayList<String> listTable = new ArrayList<String>();
       // listTable.add("TIC_TASK");
//        listTable.add("TIC_TASK_CURRENT_STATUS");
//        listTable.add("TIC_TASK_DEFINITION");
//        listTable.add("TIC_TASK_TIMING");
//        listTable.add("TIC_THREAD_CURRENT_STATUS");
//        listTable.add("TIC_THREAD_MANAGER");
//        listTable.add("TIC_COMPANY"); 
//        listTable.add("TIC_RIGHT");
//        listTable.add("TIC_FUNCTION");
//        listTable.add("TIC_FUNCTION_ARGUMENT");
//        listTable.add("TIC_RIGHT_FUNCTION");
//        listTable.add("TIC_ROLE");
//        listTable.add("TIC_ROLE_RIGHT");
        
//        listTable.add("TIC_SCHEDULER_LOG");
//        listTable.add("TIC_FUNCTION");
//        listTable.add("TIC_FUNCTION_ARGUMENT");
//        listTable.add("TIC_RIGHT_FUNCTION");
        listTable.add("TIC_CUSTOMER");
//        listTable.add("TIC_ADMIN");
        
                //HVKOracleDiscover.getAllTableName("TICD");
        for (String a : listTable) {
            System.out.println(a);

            HVKTableInfo tabInfo = HVKOracleDiscover.getHVKTableInfo(a);

             for(HVKColumnInfo tc: tabInfo.colums.values())
             {
                 System.out.println(tc.name + " : " + tc.type + " : "+tc.isPrimaryKey);
             }
            
//            String xyz = HVKBaseUtils.MakeModelBodyFormTable(tabInfo);
//            System.out.println(xyz);
            HVKBaseUtils.MakeSQLMapFileFromTable(tabInfo);
            HVKBaseUtils.MakeModelFileFromTable(tabInfo);
            System.out.println( HVKBaseUtils.MakeIbatisDaoFileFromTable(tabInfo));
            System.out.println (HVKBaseUtils.MakeDaoFileFromTable(tabInfo));
             System.out.println (HVKBaseUtils.MakeServiceFileFromTable(tabInfo));
              System.out.println (HVKBaseUtils.MakeDaoServiceFileFromTable(tabInfo));
        }

//       System.out.println(abc);
//       
//       String model = HVKBaseUtils.MakeModelBodyFormTable(tableInfo);
//       System.out.println(model)

    }
}
